package com.cqnu.controller;


import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cqnu.entity.PaperLog;
import com.cqnu.entity.commonModel.AjaxResult;
import com.cqnu.entity.commonModel.PageParameters;
import com.cqnu.service.IPaperLogService;
import com.cqnu.service.IPaperService;

@Controller
@RequestMapping("/paper")
public class PaperController extends BaseController{
	
	@Resource
	private IPaperLogService paperLogService;
	@Resource
	private IPaperService paperService;

	@RequestMapping("/logList.do")
	@ResponseBody
	public AjaxResult goQueryThesis(HttpServletRequest request,PaperLog log,PageParameters par){
		AjaxResult aj = new AjaxResult();
		Map<String, Object> map = this.getMap(par);
		if (log != null) {
			if (log.getCreattime() !=null) {
				map.put("creattime", "%" + log.getCreattime() + "%");
			}
		}
		aj.setRows(paperLogService.find(map));
		aj.setTotal(paperLogService.getTotal(this.clearPar(map)).intValue());
		return aj;
	}
	
	@RequestMapping("/getById.do")
	@ResponseBody
	public Object getById(Integer id){
		return paperService.getById(id);
	}
}
